const user = {
	state: {
		userToken:uni.getStorageSync('userToken')||'',
		userInfo:uni.getStorageSync('userInfo')||'',
		APPTheme:uni.getStorageSync('APPTheme')||'theme-light',//app主题主题默认为浅色theme-light，theme-dark为深色
		rememberPassword:uni.getStorageSync('rememberPassword')||'',//记住用户密码
		//证件类型
		documentTypeList:[
			{value: '0',label: '居民身份证'},
			{value: '1',label: '护照'},
			{value: '8',label: '企业营业执照'},
			{value: 'B',label: '港澳居民来往内地通行证'},
			{value: 'C',label: '台湾居民来往大陆通行证'},
			{value: 'H',label: '事业单位法人证书'},
			{value: 'J',label: '社会团体登记证书'},
			{value: 'N',label: '企业统一社会信用代码'}
		],
	},
	mutations: {
		SET_userToken:(state, userToken)=>{
			state.userToken=userToken
		},
		SET_userInfo:(state, userInfo)=>{
			state.userInfo=userInfo
		},
		SET_APPTheme:(state, APPTheme)=>{
			state.APPTheme=APPTheme
		},
		SET_rememberPassword:(state,rememberPassword)=>{
			state.rememberPassword=rememberPassword
		},
		REMOVE_rememberPassword:(state,rememberPassword)=>{
			state.rememberPassword=rememberPassword
		},
	},
	actions: { //异步操作mutation
		remove_userInfo({commit}, userInfo) {
			uni.removeStorageSync('userInfo');
			commit('SET_userInfo', userInfo)
		},
		set_userToken({commit}, userToken) {
			uni.setStorageSync('userToken', userToken);
			commit('SET_userToken', userToken)
		},
		set_userInfo({commit}, userInfo) {
			uni.setStorageSync('userInfo', userInfo);
			commit('SET_userInfo', userInfo)
		},
		set_APPTheme({commit}, APPTheme) {
			uni.setStorageSync('APPTheme', APPTheme);
			commit('SET_APPTheme', APPTheme)
		},
		set_rememberPassword({commit},rememberPassword){
			uni.setStorageSync('rememberPassword', rememberPassword);
			commit('SET_rememberPassword', rememberPassword)
		},
		remove_rememberPassword({commit},rememberPassword){
			uni.removeStorageSync('rememberPassword');
			commit('REMOVE_rememberPassword', rememberPassword)
		},
		remove_logout({commit},rememberPassword){
			uni.removeStorageSync('userInfo');
			uni.removeStorageSync('userToken');
		}
		
	}
}

export default user
